import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import { createPinia } from "pinia";
import router from "./router";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import { Swipe, SwipeItem } from "vant"; // 引入 Vant 组件
import 'vant/lib/index.css' 
import 'vant/lib/swipe/style' 
import 'vant/lib/swipe-item/style';
import 'font-awesome/css/font-awesome.min.css';
import { Lazyload } from 'vant';

// 创建 Vue 应用实例
const app = createApp(App);

// 全局注册 Vant 组件
app.use(Swipe);
app.use(SwipeItem);
app.use(Lazyload);

// 注册 ElementPlus 插件
app.use(ElementPlus);

// 创建 Pinia 实例并使用持久化插件
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);

// 注册 Pinia 插件
app.use(pinia);

// 注册路由插件
app.use(router);

// 挂载应用并处理可能出现的错误
try {
    app.mount("#app");
    console.log("应用挂载成功");
} catch (error) {
    console.error("应用挂载失败:", error);
}